#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>

using namespace std;

const int n=5000, q=5000;

void makeData(int u, int v, int w) {
    FILE *f=fopen("stone.in", "w");
    fprintf(f, "%d\n", u);
    for (int i=2; i<=u; i++)  {
        fprintf(f, "%d ", rand()%(i-1)+1);
    }
    fprintf(f, "\n%d\n", v);
    for (int i=1; i<=v; i++) {
        int m=rand()%w+1;
        fprintf(f, "%d ", m);
        static bool book[n+1];
        memset(book, 0, sizeof book);
        for (int j=1; j<=m; j++)  {
            int t;
            for (t=rand()%u+1; book[t]; t=rand()%u+1);
            fprintf(f, "%d ", t);
            book[t] = true;
        }
        fprintf(f, "\n");
    }
}

int main() {
    srand(time(0));
    int tn, tq, tm;
    scanf("%d %d %d", &tn, &tq, &tm);
    for (;;) {
        makeData(tn, tq, tm);
        if (system("./bin")) {
            printf("RE!\n");
            return -1;
        } else if (system("./check")) {
            printf("CE!\n");
            return -1;
        } else if (system("cmp stone.out check.out")) {
            printf("WA!\n");
            return -1;
        }
    }
    return 0;
}
